package com.qian.service.ddj.entity;

import com.yaowk.service.common.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Version;
import java.math.BigDecimal;
import java.util.Date;

@Getter
@Setter
@ToString
@Entity
@DynamicUpdate
@DynamicInsert
public class DdjOrder extends BaseEntity<Integer> {

    private Integer userId;
    private Integer businessId; // 商户id
    private String outOrderNo; // 下游订单号
    private String orderNo; // 平台订单号
    private String upOrderNo; // 上游订单号
    @Column(nullable = false)
    private BigDecimal amount; // 支付金额
    private BigDecimal realAmount; // 实际支付金额
    private BigDecimal amountFee; // 手续费
    @ColumnDefault("0")
    private Byte settlementD0; // d0已结算
    @ColumnDefault("0")
    private Byte settlementD1; // d1已结算金额
    @ColumnDefault("0")
    private Byte settlementT0; // t0已结算金额
    @ColumnDefault("0")
    private Byte settlementT1; // t1已结算金额
    @ColumnDefault("0")
    private Byte settlementFee; // 是否结算费率
    private String body; // 自带参数
    @Column(nullable = false, updatable = false)
    @CreationTimestamp
    private Date createTime; // 下单时间
    private Date payTime; // 支付时间
    @ColumnDefault("1")
    private Byte status; // 订单状态
    private Byte payType; // 支付方式
    private String notifyUrl; // 回调地址
    private String frontUrl;
    private String code; // 二维码内容
    private String remark; // 备注
    private String payerIp; // 支付者ip
    private Long codeId;

    @Version
    private Integer version; // 乐观锁
}
